package com.example.dllo.baidumusic.fragment;
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         佛祖保佑       永无BUG
*/

import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;

import com.example.dllo.baidumusic.R;
import com.example.dllo.baidumusic.adapter.AllSingerAdapter;
import com.example.dllo.baidumusic.bean.HotSinger;
import com.example.dllo.baidumusic.nettool.URLValuas;
import com.example.dllo.baidumusic.nettool.BaseFragment;
import com.example.dllo.baidumusic.nettool.NetTool;

/**
 * Created by dllo on 16/8/18.
 */
public class AllSingerFragment extends BaseFragment {
    private RecyclerView recyclerView;
    private AllSingerAdapter allSingerAdapter;

    @Override
    protected int setLayout() {
        return R.layout.fragment_allsinger;
    }

    @Override
    protected void initView() {
        recyclerView = bindView(R.id.hotsinger_rv);
        StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(manager);
        allSingerAdapter = new AllSingerAdapter(getContext());


    }

    @Override
    protected void initData() {

        NetTool netTool = new NetTool();
        netTool.getNetData(URLValuas.HoT_SINGER, HotSinger.class, new NetTool.NetListener<HotSinger>() {
            @Override
            public void onSuccess(HotSinger hotSinger) {
                allSingerAdapter.setArrayList(hotSinger);
                recyclerView.setAdapter(allSingerAdapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });

    }
}
